
class Translate:
    def __init__(self, directly: bool, from_lang: str, to_lang: str, content: str):
        self.directly = directly
        self.from_lang = from_lang
        self.to_lang = to_lang
        self.content = content

    def getRequestPrompt(self):
        if self.directly:
            return f"{self.content}"
        else:
            return f"translate the following text into {self.to_lang}\n{self.content}"


def translate_object_hook(d):
    return Translate(bool(d['directly']), d['from'], d['to'], d['content'])
